# Contributor: Stone Tickle <lattis@mochiro.moe>
# Maintainer: Stone Tickle <lattis@mochiro.moe>
pkgname=muon
pkgver=0_git20220710
_commit=d854313e000724b5900fd821440b89c9e789d196
pkgrel=0
pkgdesc="A meson-compatible build system."
url="https://muon.build"
arch="all"
license="GPL-3.0-only AND Apache-2.0"
depends="samurai"
makedepends="scdoc curl-dev libarchive-dev pkgconf-dev python3 py3-yaml"
subpackages="$pkgname-doc"
source="
	$pkgname-$_commit.tar.gz::https://git.sr.ht/~lattis/muon/archive/$_commit.tar.gz
	https://mochiro.moe/wrap/meson-docs-0.63.0-40-g280f3423b.tar.gz
"
builddir="$srcdir/$pkgname-$_commit/"

build() {
	mv ../meson-docs subprojects/
	./bootstrap.sh build
	build/muon setup build
	samu -C build

	# options copied from abuild-meson
	build/muon setup \
		-Dprefix=/usr \
		-Dlibdir=/usr/lib \
		-Dlibexecdir=/usr/libexec \
		-Dbindir=/usr/bin \
		-Dsbindir=/usr/sbin \
		-Dincludedir=/usr/include \
		-Ddatadir=/usr/share \
		-Dmandir=/usr/share/man \
		-Dinfodir=/usr/share/info \
		-Dlocaledir=/usr/share/locale \
		-Dsysconfdir=/etc \
		-Dlocalstatedir=/var \
		-Dsharedstatedir=/var/lib \
		-Dbuildtype=plain \
		-Dauto_features=auto \
		-Dwrap_mode=nodownload \
		-Db_lto=false \
		-Db_staticpic=true \
		-Db_pie=true \
		build

	samu -C build
}

check() {
	build/muon -C build test -d dots
}

package() {
	DESTDIR=$pkgdir build/muon -C build install
}

sha512sums="
7d02c768cbc6b74a1b51009dc2f82d436251fb190ec94efe772bfc70fcc09c1b19cdcc2e7c0ed7234dfc80cf395c49206ae9c1ebd2ce1ea5acc9236eb9f65c2c  muon-d854313e000724b5900fd821440b89c9e789d196.tar.gz
119e6b857e109af47044d0a1515d377490f4c4f4b94a4134f642cf1ed5d9ad7ffc99628133ed5fb49d46891469fddb369b8a469f8eb07a903421b48b835a64e3  meson-docs-0.63.0-40-g280f3423b.tar.gz
"
